<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title>输出数组元素</title>
</head>

<body>
<script type="text/javascript">
var students = new Array(3);//定义数组
students[0] = "张三";//为下标为0的数组元素赋值
students[1] = "李四";//为下标为1的数组元素赋值
students[2] = "王五";//为下标为2的数组元素赋值
for(var i=0;i<3;i++){
	document.write("第"+(i+1)+"个学霸姓名是："+students[i]+"<br>");//循环输出数组元素
}
</script>
</body>
</html>
